<template>
  <div class="app-container">
    <!-- Header 区域 -->
    <es-header></es-header>

    <!-- 商品 Item 项组件 -->
    <es-goods v-for="item in list" :key="item.id" :item="item"></es-goods>

    <!-- Foote 区域 -->
    <es-footer></es-footer>
  </div>
</template>

<script>
import EsHeader from "@/components/Header.vue";
import EsFooter from "@/components/Footer.vue";
import EsGoods from "@/components/Goods.vue";
import { mapState } from "vuex";

export default {
  name: "App",
  computed: {
    ...mapState("cart", ["list"]),
  },
  components: {
    EsHeader,
    EsFooter,
    EsGoods,
  },
  created() {
    this.$store.dispatch("cart/initData");
  },
  computed: {
    ...mapState("cart", ["list"]),
  },
};
</script>

<style lang="less" scoped>
.app-container {
  padding: 46px 0 50px 0;
}
</style>
